// Copyright DustedPixels.com 2008. All rights reserved.

package com.dustedpixels.asm.analysis;

import org.objectweb.asm.tree.analysis.Value;

/**
 * @author micapolos@gmail.com (Michal Pociecha-Los)
 */
public final class ValueUtils {
  /**
   * Returns new value which is like given value or null if given value is null.
   * 
   * @param value given value, possibly null
   * @return new value
   */
  public static Value newLike(Value value) {
    if (value == null) {
      return null;
    } else {
      final int size = value.getSize();
      return new Value() {
        public int getSize() {
          return size;
        }
      };
    }
  }
}
